using System;
using System.Threading;

namespace MultithreadingApplication
{
  // sleep() 方法的使用，用于在一个特定的时间暂停线程。
  class ThreadCreationProgram
  {
    public static void CallToChildThread()
    {
      Console.WriteLine("Child thread starts");
      // 线程暂停 5000 毫秒
      int sleepfor = 5000;
      Console.WriteLine("Child Thread Paused for {0} seconds",
                        sleepfor / 1000);
      Thread.Sleep(sleepfor);
      Console.WriteLine("Child thread resumes");
    }

    static void Main(string[] args)
    {
      ThreadStart childref = new ThreadStart(CallToChildThread);
      Console.WriteLine("In Main: Creating the Child thread");
      Thread childThread = new Thread(childref);
      childThread.Start();
      Console.ReadKey();
    }
  }
}